class code1 {
    //存在重复元素:set
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for(int x:nums) {
            if(!set.contains(x)) {
                set.add(x);
            } else {
                return true;
            }
        }
        return false;
    }
}